package example.com.terry.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * ClassName: QueryWorkServlet <br/>
 * Description: 页面跳转 <br/>
 * Date: 2020/5/21 下午5:27 <br/>
 * <br/>
 *
 * @author ls
 * <p/>
 * 修改记录
 * @version 1.0<br />
 */
@WebServlet("/jump")
public class CommonJumpServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String type = req.getParameter("type");
        if (null == type) {
            type = (String) req.getAttribute("type");
        }
        //每增加一个页面 在switch 里面添加一个 case  还有一个跳转地址 和brack 跳出语句
        switch (type) {
            case "0":
                req.getRequestDispatcher(   "/WEB-INF/jsp/notic.jsp").forward(req, resp);

                break;
            //去往主页
            case "1":
                req.getRequestDispatcher("/WEB-INF/jsp/work.jsp").forward(req, resp);
                break;
            // 去往登陆页面
            case "2":
                req.getRequestDispatcher("WEB-INF/jsp/notic.jsp").forward(req, resp);
                break;
            // 去往注册页面
            case "3":
                req.getRequestDispatcher("/WEB-INF/jsp/user.jsp").forward(req, resp);
                break;
            case "4":
                req.getRequestDispatcher("/WEB-INF/jsp/property.jsp").forward(req, resp);
                break;

            case "5":
                req.getRequestDispatcher("/WEB-INF/jsp/schedule.jsp").forward(req, resp);
                break;
        }


    }
}
